package models

import (
	"cloud-disk/core/internal/config"
	"github.com/minio/minio-go/v7"
	"github.com/minio/minio-go/v7/pkg/credentials"
	"log"
)

func InitMinio(config config.Config) *minio.Client {
	minioClient, err := minio.New(config.Minio.Endpoint, &minio.Options{
		Creds: credentials.NewStaticV4(config.Minio.AccessKeyID, config.Minio.SecretAccessKey, "")})
	if err != nil {
		log.Fatalln(err)
	}
	return minioClient
}
